<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions">
<h:body>
	<ui:composition template="/WEB-INF/templates/template_2.xhtml">
		<ui:define name="content">
			<h2>
				<h:outputText value="#{msg.title_login}" />
			</h2>
			<h:form>
			#{login_controller.validateLogin()}
			<p:growl id="growlLogin" sticky="false" autoUpdate="true" />
			</h:form>
			<h:form id="formLogin" prependId="false" onsubmit="enviar();" 
				>
				<h:panelGrid columns="3" bgcolor="#eff5fa" cellspacing="5"
					frame="box" id="panel">
					<p:outputLabel for="j_username" value="#{msg.user_name}" />
					<p:inputText id="j_username" tabindex="1" required="true" requiredMessage="#{msg.required_input_username}"/>
					<p:message for="j_username" />
					<p:outputLabel for="j_password" value="#{msg.user_password}" />
					<p:password id="j_password" required="true" requiredMessage="#{msg.required_input_password}"/>
					<p:message for="j_password" />
					<h:outputLabel value="" />
					<p:commandButton id="login" value="#{msg.login_button}"
						 validateClient="true"
						 ajax="false" />
				</h:panelGrid>
				
				<script type="text/javascript">
					function enviar(){
						PF('blockUIWidget').block();
						document.getElementById('formLogin').action = 'https://#{request.serverName}:#{request.serverPort}#{request.contextPath}/j_security_check';
						document.getElementById('formLogin').submit();
						}
				</script>
			</h:form>
			<pe:blockUI widgetVar="blockUIWidget">
				<h:panelGrid columns="1">
					<img src="#{request.contextPath}/images/ajax_gif.gif" />
				</h:panelGrid>
			</pe:blockUI>
		</ui:define>
	</ui:composition>

</h:body>

</html>